<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-wages-edit" th:object="${wages}">
            <input name="id" th:field="*{id}" type="hidden">
            <p id="userids" hidden> </p>
           <!-- <div class="form-group">
                <input name="farmlandId"  class="form-control" type="hidden">
                <button type="button" class="btn btn-info" onclick="selectUsersToParent()">请选择用户</button>
            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">涨薪或扣薪：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('money_up_or_down')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">金额：</label>
                <div class="col-sm-8">
                    <input name="monkey" th:field="*{monkey}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="time" th:value="${#dates.format(wages.time, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">金额对应信息：</label>
                <div class="col-sm-8">
                    <input name="msg" th:field="*{msg}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">类型：</label>
                <div class="col-sm-8">
                    <select name="wtype" class="form-control m-b" th:with="type=${@dict.getType('wtype')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{wtype}"></option>
                    </select>
                </div>
            </div>
          <!--  <div class="form-group">
                <label class="col-sm-3 control-label">时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="createTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">是否有效：</label>
                <div class="col-sm-8">
                    <select name="isok" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isok}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />

    <!--cookie-->
    <script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>

    <script th:inline="javascript">
        var prefix = ctx + "system/wages";
        $("#form-wages-edit").validate({
            focusCleanup: true
        });



        function selectUsersToParent(){
            $.modal.open("请选择用户",  "/system/config/parent");
        }


        /*cookic取值*/
        var param = $.cookie('uid');
        console.log("edit页面 cookie中拿到的uid="+param);
        $("#uid").val(param);

        function submitHandler() {
            if ($.validate.form()) {
                alert("来到edit.html");
                var c = $('#userids').text();
                console.log("最终的传入到后台的参数uid ="+c)
                var a = 'uid='+param+'&'+$('#form-wages-edit').serialize();
                $.operate.save(prefix + "/edit", a);
            }
        }



        $("input[name='time']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>
